<!--
 * @Author: your name
 * @Date: 2021-07-20 11:10:39
 * @LastEditTime: 2021-07-20 13:04:52
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \hduforeign-copy\src\views\components\News\New.vue
-->
<template>
  <div class="news">
    <div class="news-head">
      <div class="head-img">
        <img src="../../../../public/images/icon_02.jpg" alt="" />
      </div>
      <div class="title">{{ title }}</div>
      <div class="more">
        <img :src="more" alt="" />
      </div>
    </div>
    <div class="news-body">
      <img src="../../../../public/images/notice_l.jpg" alt="" class="borderz" />
      <img src="../../../../public/images/notice_l.jpg" alt="" class="bordery" />
      <ul>
        <li class="article" @click="toArticle(item.id)" v-for="item in news" :key="item.id">
          <div class="box1">
            <div class="xiaodian"><img :src="xiaoyuandian" alt="" /></div>

            <a href="#" class="msg">{{ item.title }}</a>
          </div>

          <div class="box2">
            <p class="date">{{ item.publishTime | fmtDate }}</p>
          </div>
        </li>
      </ul>
    </div>
  </div>
</template>
<script>
import { get } from '../../../utils/request'

export default({
    props:{
        news:{
            type:Array,
            default(){
                return []
            },
        },
        title:{
            type:String,
            default:'',
        },
    },
    data(){
        return{
            articleData:{},
            param:{
                page:1,
                pageSize:5,
            },
            name:'',
            xiaoyuandian:'',
            more:'',
        }
    },
    created(){
        this.loadXiaoyuandian()
        this.loadMore()
    },
    methods:{
        //加载小圆点
    loadXiaoyuandian() {
      let url = '/index/findByKey'
      get(url, { name: 'xiaoyuandian' }).then((resp) => {
        if (resp.data) {
          this.xiaoyuandian = resp.data.val
          // console.log(resp.data);
        }
      })
    },
    
    // 加载更多
    loadMore() {
      let url = '/index/findByKey'
      get(url, { name: 'more' }).then((resp) => {
        if (resp.data) {
          this.more = resp.data.val
        }
      })
    },
    toArticle(articleId){
        this.$router.push({
            path:'/article',
            query:{articleId},
        })
    },
    }
})
</script>


<style scoped>
* {
  margin: 0;
  padding: 0;
}
ul li {
  list-style: none;
}
.news {
  float: left;
  overflow: hidden;
  width: 60%;
  height: 300px;
  /* border-radius: 5px 5px 0 0; */
  /* background-color: rgb(224, 242, 246); */

  /* border-image: url(../../../public/images/notice_l.jpg); */
}
.news .news-head {
  background-image: linear-gradient(
    to bottom,
    rgb(255, 255, 255),
    rgb(206, 240, 249)
  );
  height: 30px;
  line-height: 30px;
  border: 1px solid rgb(139, 181, 230);
  border-radius: 5px 5px 0 0;
  position: relative;
}

.news .news-head .head-img {
  float: left;
  margin-left: 20px;
  margin-top: 1px;
}

.news .news-head .title {
  float: left;
  font-weight: 700;
  color: rgb(28, 93, 156);
  font-size: 1em;
  padding-left: 15px;
}
.news .news-head .more {
  /* float: right; */
  /* line-height: 40px; */
  position: absolute;
  right: 5px;
  top: 5px;
}

.news .news-head .more img {
  width: 65px;
  height: 20px;
  /* margin-right: 12px; */
  display: inline-block;
  border-radius: 15px;
  cursor: pointer;
}
.news .news-body {
  width: 100%;
  height: 270px;
  background-image: linear-gradient(
    to top,
    rgb(255, 255, 255),
    rgb(224, 242, 246)
  );
}
.news .borderz {
  float: left;
  /* display: inline-block; */
}
.news .bordery {
  float: right;
}
.news ul li {
  width: 97%;
  height: 28px;
  line-height: 28px;
  border-bottom: 1px dashed;
  margin: 0 0.5em;
  position: relative;
  display: flex;
  /* list-style:inside; */
}

.news ul li .box1 {
  flex: 1;
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  margin-right: 100px;
}
.news ul li .box1 .xiaodian {
  display: inline-block;
  width: 14px;
  height: 30px;
  line-height: 30px;
  text-align: center;
}
.news ul li .box1 .xiaodian img {
  margin-bottom: 4px;
}
.news ul li .box2 {
  display: inline-block;
  width: 65px;
  position: absolute;
  right: 0;
}
.news ul li .msg {
  color: black;
  text-decoration: none;
  font-size: 12px;
}
.news ul li p {
  display: inline-block;
  font-size: 11px;
}
</style>